package demo1;

import java.util.Random;
import java.util.Scanner;

public class demo_2 {
    public static void main(String[] args) {
        Random r = new Random();
        int guess = r.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        int c;
        do {
            System.out.println("请输入1~100的数：");
            c = sc.nextInt();
            if (c > guess)
                System.out.println("大了");
            else if (c < guess)
                System.out.println("小了");

        } while(c != guess);
        System.out.println("恭喜您回答正确");
        sc.close();
    }


}
